﻿<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>一次交检合格率打印</title>
    <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
    <style>
         tr,td{border:1px solid;text-align:center;height:40px;font-weight: bolder}
        .borderRight{border-right:none;}
        .borderBottom{border-bottom:none;}
        .table1 td{width:150px}
        .table2 td{width:125px}
    </style>
</head>
<body>
    
     <div style="text-align: center;padding-top:20px;">
        <div style="width: 900px;display:inline" id="print"></div>
     </div>
     <!--信息提示区域-->
    <div id="statusMessage" style="font-size: 14px; height: 40px"></div>
</body>
</html>
<script src="/InSiteWebApplication/Scripts/json2.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/array.pollyfill.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/CustomCommon.js" type="text/javascript"></script>
<script type="text/javascript">
    //创建人：longb
    //日期：2023-12-16
    //描述：一次交检合格率打印
    var page = {
        ajaxUrl: getRootPath() + "/Ashx/UnqualifiedHandler.ashx",
        cid: getParam("cid"),
        init: function () {
            page.initPageData();
        },
        initPageData: function () {
            var table1 = '<table class="table1" cellspacing="0" style="margin: auto"><tr><td colspan="4" class="borderBottom" style="font-size:18px;">一次交检合格率统计表</td></tr>'
                     + '<tr><td class="borderRight borderBottom">检验室</td><td class="borderRight borderBottom">燃烧检验室</td><td class="borderRight borderBottom">提交工区/中心</td><td class="borderBottom"></td></tr>'
                     + '<tr><td class="borderRight borderBottom">零件号</td><td class="borderRight borderBottom"></td><td class="borderRight borderBottom">零件名称</td><td class=" borderBottom"></td></tr>'
                     + '<tr><td class="borderRight borderBottom">批次号</td><td  class="borderRight borderBottom"></td><td  class="borderRight borderBottom">工序号</td><td  class=" borderBottom"></td></tr>'
                     + '<tr><td class="borderRight borderBottom">日期</td><td class="borderRight borderBottom"></td><td class="borderRight borderBottom">检验员</td><td class=" borderBottom"></td></tr>'
                     + '<tr><td class="borderRight borderBottom">提交数量</td><td class="borderRight borderBottom"></td><td class="borderRight borderBottom">不合格数量</td><td class="borderBottom"></td></tr>'
                     + '</table>';
            var table2 = '<table class="table2"  cellspacing="0" style="margin: auto;padding-bottom:50px;"><tr><td colspan="6" class="borderBottom">不合格特征</td></tr>';

            var allHtml = "";

            page.post({ action: 'getOneInspectionPassRate', cid: page.cid }, false, function (res) {
                var count = res.DBTable.length;
                var td = "";
                $.each(res.DBTable, function (i, item) {
                    if ((i + 1) % 2 != 0) {
                        td += '<tr><td class="borderRight borderBottom" style="width:50px">' + item.UNQUALIFIEDFEATURENO + '</td><td class="borderRight borderBottom">' + item.UNQUALIFIEDFEATURENAME + '</td><td class="borderRight borderBottom"></td>';
                    }
                    else {
                        td += '<td class="borderRight borderBottom" style="width:50px">' + item.UNQUALIFIEDFEATURENO + '</td><td class="borderRight borderBottom">' + item.UNQUALIFIEDFEATURENAME + '</td><td class="borderBottom"></td></tr>'
                    }
                    if ((i + 1) == count && (i + 1) % 2 != 0) {
                        td += '<td colspan="3" class="borderBottom" ></td></tr>'
                    }
                });
                table2 += td + '<tr><td class="borderRight borderBottom" style="width:50px">' + (count + 1) + '</td><td colspan="5" class="borderBottom" style="text-align:left;padding-left:10px;">其他不合格特征请写明</td></tr><tr><td colspan="6"></td></tr></table>';

                $.each(res.ReturnData, function (j, itemp) {
                    allHtml += '<table class="table1" cellspacing="0" style="margin: auto"><tr><td colspan="4" class="borderBottom" style="font-size:18px;">一次交检合格率统计表</td></tr>'
                     + '<tr><td class="borderRight borderBottom">检验室</td><td class="borderRight borderBottom">燃烧检验室</td><td class="borderRight borderBottom">提交工区/中心</td><td class="borderBottom">' + itemp.WORKCENTERNAME + '</td></tr>'
                     + '<tr><td class="borderRight borderBottom">零件号</td><td class="borderRight borderBottom">' + itemp.PRODUCTNAME + '</td><td class="borderRight borderBottom">零件名称</td><td class=" borderBottom">' + itemp.PRODUCTDESCRIPTION + '</td></tr>'
                     + '<tr><td class="borderRight borderBottom">批次号</td><td  class="borderRight borderBottom">' + itemp.CONTAINERNO + '</td><td  class="borderRight borderBottom">工序号</td><td  class=" borderBottom">'+itemp.SPECNO+'</td></tr>'
                     + '<tr><td class="borderRight borderBottom">日期</td><td class="borderRight borderBottom">' + itemp.CREATEDATE + '</td><td class="borderRight borderBottom">检验员</td><td class=" borderBottom">' + itemp.CHECKERNAME + '</td></tr>'
                     + '<tr><td class="borderRight borderBottom">提交数量</td><td class="borderRight borderBottom">' + itemp.CHECKQTY + '</td><td class="borderRight borderBottom">不合格数量</td><td class="borderBottom">'+itemp.NOQTY+'</td></tr>'
                    allHtml += table2;
                });

            });
            $('#print').html(allHtml == "" ? (table1 + table2) : allHtml);
        },
        //清除方法，重要！！！
        reset: function (iscondition, isresult) {
            clearMessage();
        },
        //post数据
        post: function (param, async, callback) {
            $.ajax({
                type: "Post",
                url: page.ajaxUrl,
                data: param,
                cashe: false,
                async: async,
                dataType: "json",
                beforeSend: function () {
                    $.messager.progress({ text: '', msg: '处理中...' });
                },
                success: function (data) {
                    $.messager.progress('close');
                    callback(data);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $.messager.progress('close');
                    displayMessage(XMLHttpRequest.responseText, false);
                }
            });
        }
    }
    $(function () {
        page.init();
    });



</script>
